package com.java2104.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.java2104.entity.LoginUser;
import com.java2104.mapper.LoginUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Map;
import java.util.function.Function;

@Service
public class LoginUserService implements IService<LoginUser> {

    @Autowired
    private LoginUserMapper loginUserMapper;

    @Override
    public BaseMapper<LoginUser> getBaseMapper() {
        return loginUserMapper;
    }

    public LoginUser login(String loginName,String password){
        QueryWrapper queryWrapper = new QueryWrapper();
        if(loginName!=null && !"".equals(loginName.trim())){
            queryWrapper.eq("login_name",loginName);
        }
        queryWrapper.eq("password",password);
        LoginUser loginUser = loginUserMapper.selectOne(queryWrapper);
        if(loginUser!=null){
            return loginUser;
        }
        return null;
    }

    @Override
    public boolean saveBatch(Collection<LoginUser> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<LoginUser> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<LoginUser> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(LoginUser entity) {
        return false;
    }

    @Override
    public LoginUser getOne(Wrapper<LoginUser> queryWrapper, boolean throwEx) {
        return null;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<LoginUser> queryWrapper) {
        return null;
    }

    @Override
    public <V> V getObj(Wrapper<LoginUser> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public Class<LoginUser> getEntityClass() {
        return null;
    }
}
